/* Plans */

+!request(N, G): satisfied(G) | passed(G, _)
	<- .print(G, " has been satisfied or passed to somebody.").

+!request(N, G): 
	plan(and_decomposes2(N, G, G1, G2)) 
	<-
	.print(N, " decompose goal [", G, "] to [", G1, ", ", G2, "]");
	!request(N, G1);
	!request(N, G2);
	mark(and_decomposes2(N, G, G1, G2), accomplished).
	
+!request(N, G): 
	plan(and_decomposes3(N, G, G1, G2, G3)) 
	<-
	.print(N, " decompose goal [", G, "] to [", G1, ", ", G2, ", ", G3, "]");
	!request(N, G1);
	!request(N, G2);
	!request(N, G3);
	mark(and_decomposes3(N, G, G1, G2, G3), accomplished).

+!request(N, G):
	plan(passes(N, T, G))
	<-
	mark(passes(N, T, G), executing);
	+delegating(N, T, G).
	
+!request(N, G):
	plan(satisfies(N, G))
	<-
	+pending_task(fulfill(N, G)).

// suppose that this goal will be fulfilled somewhere
+!request(N, G): true <- .print(G, " is fulfilled somewhere else."). 